Fix invokable objects incorrectly labeled as instances of Closure#4797
Fix invokable objects incorrectly labeled as instances of Closure#4797HypeMC wants to merge 1 commit intophpstan:2.1.xfrom
Closure#4797Conversation
a02e586 to
6d1e13c
Compare
src/Type/Accessory/HasMethodType.php
Outdated
| if ( | ||
| $this->isCallable()->yes() | ||
| && $otherType->isCallable()->yes() | ||
| && !($otherType->isObject()->yes() && $otherType->isInstanceOf(Closure::class)->yes()) |
There was a problem hiding this comment.
@ondrejmirtes Hi, I'm not sure how to proceed here. I tried using instanceof, but PHPStan said I should use isObject() instead. Now I'm getting this error. Any advice?
There was a problem hiding this comment.
see other similar spots in the codebase.
it need to look like (new ObjectType(Closure::class))->isSuperTypeOf(...)
| $this->assertNoErrors($errors); | ||
| } | ||
|
|
||
| public function testBug13975(): void |
There was a problem hiding this comment.
your test needs to be moved into a *RuleTest which relates to the error message you no longer want to have.
AnalyzerIntegrationTest is reserved for performance and crash-tests
There was a problem hiding this comment.
I guess an additional test like https://phpstan.org/r/3cdd0efb-d240-49dd-9073-d1ada4d9843e might kill the mutant
There was a problem hiding this comment.
it seems you lost the original test-case while adding the new one.
There was a problem hiding this comment.
Oh sorry, I misunderstood you, fixed
1a0435a to
47220f6
Compare
Closes phpstan/phpstan#13975